package com.usian.admin.controller;

import com.usian.admin.service.AdSensitiveService;
import com.usian.apis.admin.AdSensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/adSensitive")
@Api(value = "敏感词管理" ,tags = "AdSensitive", description = "敏感词管理API")
public class AdSensitiveController implements AdSensitiveControllerApi {
    @Autowired
    private AdSensitiveService adSensitiveService;

    @PostMapping("findPage")
    @Override
    @ApiOperation(value = "查询敏感词信息")
    @ApiImplicitParam(name = "dto",type ="SensitiveDto")
    public ResponseResult findPage(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findPage(dto);
    }

    @PostMapping("insert")
    @Override
    @ApiOperation(value = "插入敏感词信息",notes = "插入敏感词信息")
    @ApiImplicitParam(name = "adSensitive",type ="AdSensitive",value = "AdSensitive对象插入")
    public ResponseResult insert(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    @PostMapping("update")
    @Override
    @ApiOperation(value = "修改敏感词信息",notes = "修改敏感词信息")
    @ApiImplicitParam(name = "adSensitive",type ="AdSensitive",value = "AdSensitive对象修改")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }

    @DeleteMapping("del/{id}")
    @Override
    @ApiOperation(value = "删除敏感词信息",notes = "删除敏感词信息")
    @ApiImplicitParam(name = "id",type ="Integer",value = "AdSensitive对象删除")
    public ResponseResult del(@PathVariable("id") Integer id) {
        return adSensitiveService.del(id);
    }
}
